home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / dev / misc / LEDA_gene.lha / LEDA-3.1c-generic / prog / graphics / panel_demo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-05  |  1.5 KB  |  77 lines

  1. #include <LEDA/window.h>
  2.  
  3. main()
  4.   bool   B     = false;
  5.   double R     = 3.1415;
  6.   int    C     = 0;
  7.   int    C1    = 0;
  8.   int    N     = 100;
  9.   string S     = "dummy";
  10.   string S1    = "menu";
  11.  
  12.   int    but_num = 30;
  13.  
  14.   list<string> menu;
  15.  
  16.   menu.append("menu-item-1");
  17.   menu.append("menu-item-2");
  18.   menu.append("menu-item-3");
  19.   menu.append("menu-item-4");
  20.   menu.append("menu-item-5");
  21.   menu.append("menu-item-6");
  22.   menu.append("menu-item-7");
  23.   menu.append("menu-item-8");
  24.  
  25. for(;;)
  26. {
  27.  
  28.   panel P("PANEL DEMO");
  29.  
  30.   P.text_item("Here we have a text item (just a line of text) and");
  31.   P.text_item("another text item, followed by an empty line");
  32.   P.text_item("");
  33.  
  34.   P.bool_item("bool_item",B);
  35.  
  36.   P.choice_item("choice_item",C,"zero","one","two","three", "four");
  37.  
  38.   P.int_item("int_item(0,80,20)",C1,0,80,20);
  39.  
  40.   P.int_item("int_item(1,60)",but_num,1,60);
  41.  
  42.   P.int_item("int_item",N);
  43.  
  44.   P.double_item("double_item",R);
  45.  
  46.   P.string_item("string_item",S);
  47.  
  48.   P.string_item("string_item(menu)",S1,menu);
  49.  
  50.  
  51.   for(int i=0; i < but_num; i++) P.button(string("%d",i));
  52.  
  53.   P.button("quit");
  54.  
  55.   int button = P.open();
  56.  
  57.   if (button == i) break;
  58.  
  59.   printf("BOOL          = %d\n",B);
  60.   printf("CHOICE        = %d\n",C);
  61.   printf("INT (CHOICE)  = %d\n",C1);
  62.   printf("INT (SLIDER)  = %d\n",but_num);
  63.   printf("INT           = %d\n",N);
  64.   printf("REAL          = %f\n",R);
  65.   printf("STRING        = %s\n",~S);
  66.   printf("STRING (MENU) = %s\n",~S1);
  67.   printf("BUTTON        = %d\n",button);
  68.   newline;
  69.  
  70.  
  71.  }
  72.  
  73.   return 0;
  74. }
  75.  
  76.